<template>
	<view class="productItem" @click="goDetail">
		<view class="info-wrapper">
			<image :src="source.productImage" mode="aspectFill" class="product-image"></image>
			<view class="info">
				<view class="title">
					{{ source.productName }}
				</view>
				<view class="number">
					货号：{{ source.productCode }}
				</view>
				<view class="spec-wrapper">
					<!-- <view class="price">
						￥28.8/件
					</view> -->
					<view class="spec">
						毛重{{ source.grossWeight }}斤 净重{{ source.netWeight }}斤
					</view>
				</view>
			</view>
		</view>
		<view class="delivery-quantity">
			<view class="item">
				订货：{{ source.quantity }}件
			</view>
			<view class="item right">
				缺货：{{ source.stockQuantity }}件
			</view>
		</view>
		<!-- <view class="btn-wrapper">
			<view class="btn">
				质检记录
			</view>
			<view class="btn">
				交货记录
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		props: {
			index: {
				type: Number,
				default () {
					return 0
				}
			},
			source: {
				type: Object,
				default () {
					return {}
				}
			}
		},
		data() {
			return {

			}
		},
		mounted() {

		},
		methods: {
			goDetail() {
				uni.navigateTo({
					url: '/subPage_distribution/detail?code=' + this.source.orderDetailsId
				})
			}
		},
		components: {

		}
	}
</script>

<style lang="scss" scoped>
	.productItem {
		background-color: #ffffff;
		border-radius: 10upx;
		padding: 20upx;

		.info-wrapper {
			display: flex;

			.product-image {
				width: 140upx;
				height: 140upx;
				min-width: 140upx;
				margin-right: 20upx;
				border-radius: 10upx;
			}

			.info {
				flex: 1;

				.title {
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					font-size: 34upx;
					font-weight: bold;
					line-height: 38upx;
					margin-bottom: 20upx;
					width: 510rpx;
				}

				.number {
					font-size: 28upx;
					color: #555555;
					line-height: 28upx;
					margin-bottom: 20upx;
				}

				.spec-wrapper {
					display: flex;
					align-items: center;

					.price {
						font-size: 34upx;
						font-weight: bold;
						color: #FC003B;
						margin-right: 20upx;
					}

					.spec {
						font-size: 28upx;
						color: #555;
					}
				}
			}
		}

		.delivery-quantity {
			display: flex;
			align-items: center;
			padding-top: 20upx;
			margin-top: 20upx;
			border-top: 1upx solid #efefef;

			.item {
				flex: 1;
				font-size: 30upx;

				&.center {
					text-align: center;
				}

				&.right {
					text-align: right;
				}
			}
		}

		.btn-wrapper {
			display: flex;
			align-items: center;
			justify-content: flex-end;
			margin-top: 10upx;

			.date {
				flex: 1;
				font-size: 24upx;
				color: #666;
			}

			.btn {
				padding: 5upx 30upx;
				background-color: #ffffff;
				border: 1upx solid #898989;
				border-radius: 10upx;
				font-size: 28upx;
				margin-left: 15upx;

				&.primary {
					color: #ffffff;
					background-color: #018737;
					border-color: #018737;
				}
			}
		}
	}
</style>